package org.ycx.upms.dao.auto;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import org.ycx.upms.dao.model.SecAttachmentUser;
import org.ycx.upms.dao.model.SecAttachmentUserExample;

import java.util.List;

public interface SecAttachmentUserMapper {
    @SelectProvider(type=SecAttachmentUserSqlProvider.class, method="countByExample")
    long countByExample(SecAttachmentUserExample example);

    @DeleteProvider(type=SecAttachmentUserSqlProvider.class, method="deleteByExample")
    int deleteByExample(SecAttachmentUserExample example);

    @Delete({
        "delete from sec_attachment_user",
        "where ATT_ID = #{attId,jdbcType=INTEGER}",
          "and USER_ID = #{userId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(@Param("attId") Integer attId, @Param("userId") Integer userId);

    @Insert({
        "insert into sec_attachment_user (USER_ID,ATT_ID)",
        "values (#{userId,jdbcType=INTEGER},#{attId})"
    })
    int insert(SecAttachmentUser record);

    @InsertProvider(type=SecAttachmentUserSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="attId", before=false, resultType=Integer.class)
    int insertSelective(SecAttachmentUser record);

    @SelectProvider(type=SecAttachmentUserSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="ATT_ID", property="attId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="USER_ID", property="userId", jdbcType=JdbcType.INTEGER, id=true)
    })
    List<SecAttachmentUser> selectByExample(SecAttachmentUserExample example);

    @UpdateProvider(type=SecAttachmentUserSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") SecAttachmentUser record, @Param("example") SecAttachmentUserExample example);

    @UpdateProvider(type=SecAttachmentUserSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") SecAttachmentUser record, @Param("example") SecAttachmentUserExample example);
}